package operation.impl;

import book.Book;
import book.BookList;
import operation.IOperation;

/**
 * 还书
 */
public class ReturnOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("当前进行的是还书操作~");
        System.out.print("请输入书籍名称：");
        String bookName= scanner.next();
        if(bookList.contains(bookName)){
            Book book = bookList.currentBook(bookName);
            if(book.isBorrowed()==true){
                book.setBorrowed(false);
                System.out.println("还书成功！");
            }else {
                System.out.println("该书未被借出！");
            }
        }else {
            System.out.println("无该书籍~");
            return;
        }
    }
}
